/**
 * 
 */
package com.d6game.web.util;


import org.apache.commons.httpclient.NameValuePair;

/**
 * @author dell
 *
 */
public class RobotUtil {
	
	public static String askAndAnswer(String ask){
		return askAndAnswer2(ask);
	}
	/**
	 * 小黄鸡版本
	 * @param ask
	 * @return
	 */
	private static String askAndAnswer1(String ask){
		String answer = "";
		NameValuePair[] parameters = new NameValuePair[]{
				new NameValuePair("para", ask)
		};
		answer = HttpClientUtil.doPost("http://www.xiaohuangji.com/ajax.php", parameters, 6000);
		return answer;
	}
	/**
	 * 小豆机器人
	 * @param ask
	 * @return
	 */
	private static String askAndAnswer2(String ask){
		String answer = "";
		NameValuePair[] parameters = new NameValuePair[]{
				new NameValuePair("chat", ask)
		};
		answer = HttpClientUtil.doPost("http://xiao.douqq.com/bot/chat.php", parameters, 6000);
		return answer;
	}
	/**
	 * 牛人趣事版本
	 * @param ask
	 * @return
	 */
	private static String askAndAnswer3(String ask){
		String answer = "";
		NameValuePair[] parameters = new NameValuePair[]{
				new NameValuePair("txt", ask)
		};
		answer = HttpClientUtil.doPost("http://www.niurenqushi.com/app/simsimi/ajax.aspx", parameters, 6000);
		return answer;
	}
	public static void main(String[] args) {
		String ask ="你多大了";
		System.out.println(askAndAnswer1(ask));
		System.out.println(askAndAnswer2(ask));
		System.out.println(askAndAnswer3(ask));
	}
}
